#include <xp/sys/utl.h>
#include <xp/bas/stdio.h>

int xp_main ()
{
	xp_meminfo_t info;

	if (xp_getmeminfo(&info) == -1) {
		xp_fprintf (xp_stderr, XP_TEXT("cannot get meminfo\n"));
		return -1;
	}

	xp_printf (XP_TEXT("Total ram: %lu bytes\n"), (unsigned long)info.totalram);
	xp_printf (XP_TEXT("Used ram: %lu bytes\n"), (unsigned long)info.usedram);
	xp_printf (XP_TEXT("Free ram: %lu bytes\n"), (unsigned long)info.freeram);

	xp_printf (XP_TEXT("Total swap: %lu bytes\n"), (unsigned long)info.totalswap);
	xp_printf (XP_TEXT("Used swap: %lu bytes\n"), (unsigned long)info.usedswap);
	xp_printf (XP_TEXT("Free swap: %lu bytes\n"), (unsigned long)info.freeswap);

	return 0;
}
